package pkg

import (
	"encoding/json"
	"github.com/Baidu-AIP/golang-sdk/aip/censor"
	"log"
)

type TextCorsReq struct {
	ConclusionType uint64 `json:"conclusionType"`
}

func TextCors(message string) bool {
	client := censor.NewClient("iZ1OWLFgFOtMVFX4KjVs0cy1", "66tOwthkmDzXRitsJRQ9B9xLergvzpgG")
	//如果是百度云ak sk,使用下面的客户端
	res := client.TextCensor(message)
	log.Println(res)
	var resp TextCorsReq
	_ = json.Unmarshal([]byte(res), &resp)
	if resp.ConclusionType == 1 {
		return true
	}
	return false
}
